/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainWindow2.java
 *
 * Created on Aug 20, 2011, 8:08:52 AM
 */
package tuitionmanagement.gui;

import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyVetoException;
import javax.swing.ButtonGroup;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import tuitionmanagement.components.ImageDesktopPane;
import tuitionmanagement.components.ToolKitButton;
import tuitionmanagement.entity.Account;

/**
 *
 * @author Home
 */
public class MainWindow extends javax.swing.JFrame {

    JDesktopPane dtpPane = new JDesktopPane();
    JPanel pnlToolKit = new JPanel();
    ButtonGroup grpWindowList = new ButtonGroup();
    ImageDesktopPane dtpMain=new ImageDesktopPane();
    int counter = 0;
    public static Account CurrentAccount = null;

    /** Creates new form MainWindow2 */
    public MainWindow() {
        try {
            UIManager.setLookAndFeel("com.jgoodies.looks.windows.WindowsLookAndFeel");
        } catch (ClassNotFoundException ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage());
        } catch (InstantiationException ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage());
        } catch (IllegalAccessException ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage());
        } catch (UnsupportedLookAndFeelException ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
        initComponents();
        this.add(dtpMain);
        int w = Toolkit.getDefaultToolkit().getScreenSize().width;
        int h = Toolkit.getDefaultToolkit().getScreenSize().height - 22;
        this.setSize(w, h);
        //this.setSize(Toolkit.getDefaultToolkit().getScreenSize());
        this.addComponentListener(new ComponentAdapter() {

            @Override
            public void componentResized(ComponentEvent ev) {
                windowResize();
            }
        });
        pnlToolKit.setLayout(new FlowLayout(FlowLayout.RIGHT));
        ToolKitButton tlkClose = new ToolKitButton(ToolKitButton.BTN_CLOSE);
        pnlToolKit.add(tlkClose);
        mnbMainMenu.add(pnlToolKit);
        pnlToolKit.setVisible(false);
        tlkClose.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent ev) {
                CloseInnerWindow();
            }
        });
    }

    /**
     * Close active child window
     */
    public void CloseInnerWindow() {
        JInternalFrame[] frames = this.dtpMain.getAllFrames();
        for (int i = 0; i < frames.length; i++) {
            if (frames[i].isSelected()) {
                JRadioButtonMenuItem item = getWindowMenuItem(frames[i].getTitle());
                grpWindowList.remove(item);
                mnuWindow.remove(item);
                frames[i].dispose();
                if (counter > 0) {
                    counter--;
                }
                break;
            }
        }
        //if the window is the last then hide the toolkit
        if (frames.length <= 1) {
            pnlToolKit.setVisible(false);
            lblCurrentWindow.setText("none");
        } else {
            //else set focus to other window
            try {
                frames[frames.length - 1].setSelected(true);
                lblCurrentWindow.setText(frames[frames.length - 1].getTitle());
            } catch (PropertyVetoException ex) {
                JOptionPane.showMessageDialog(this, ex.getMessage());
            }
        }
    }
    //resize children windows and components after the main window

    public void windowResize() {
        this.dtpMain.setSize(this.getSize().width - 235, this.getSize().height - pnlStatusBar.getSize().height - 55);
        JInternalFrame[] frames = this.dtpMain.getAllFrames();
        if (frames != null);
        for (int i = 0; i < frames.length; i++) {
            frames[i].setSize(dtpMain.getSize());

        }
    }

    /**
     * get the child window by title
     * @param title
     * @return
     */
    public JInternalFrame getInnerWindow(String title) {
        JInternalFrame[] frames = this.dtpMain.getAllFrames();
        if (frames != null);
        for (int i = 0; i < frames.length; i++) {
            if (frames[i].getTitle().equalsIgnoreCase(title)) {
                return frames[i];
            }
        }
        return null;
    }

    public JRadioButtonMenuItem getWindowMenuItem(String text) {
        int itemCount = mnuWindow.getItemCount();
        if (itemCount > 2) {
            for (int i = 2; i < itemCount; i++) {
                if (mnuWindow.getItem(i).getText().equalsIgnoreCase(text)) {
                    JRadioButtonMenuItem item = null;
                    try {
                        item = (JRadioButtonMenuItem) mnuWindow.getItem(i);
                    } catch (Exception ex) {
                    }
                    return item;
                }
            }
        }
        return null;
    }

    public void setWindowFocus(JInternalFrame iframe) {
        try {
            iframe.setSelected(true);
        } catch (PropertyVetoException ex) {
            JOptionPane.showMessageDialog(this, ex.getMessage());
        }
    }

    /**
     * link a menu-item in Window menu with an child window
     * @param panel content panel
     * @param child_window_title title for child window
     * @param allow_duplicate the same withdow can appear more than one time or not
     */
    public void linkMenuWithEvent(JPanel panel, String child_window_title, boolean allow_duplicate) {
        String title = child_window_title;
        JInternalFrame iFrame = getInnerWindow(title);
//add menu
        if (iFrame != null) {
            //if the window is not allow to dupplicate, it will be set focus when user click the menu
            if (!allow_duplicate) {
                setWindowFocus(iFrame);
                return;
            }
            counter++;
            title += " [" + String.valueOf(counter) + "]";
        }
        //init child window
        iFrame = new JInternalFrame();
        iFrame.setMaximizable(true);
        iFrame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        //add content panel to child window
        iFrame.getContentPane().add(panel);
        this.dtpMain.add(iFrame);
        iFrame.setVisible(true);
        iFrame.setSize(dtpMain.getSize());
//remover border and title bar
        ((BasicInternalFrameUI) iFrame.getUI()).setNorthPane(null);
        iFrame.setBorder(null);
        iFrame.setTitle(title);
        lblCurrentWindow.setText(title);
        //create menu item in Window menu
        JRadioButtonMenuItem menu_item = new JRadioButtonMenuItem(title);
        menu_item.setActionCommand(title);
        menu_item.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                try {
                    getInnerWindow(e.getActionCommand()).setSelected(true);
                    lblCurrentWindow.setText(e.getActionCommand());

                } catch (PropertyVetoException ex) {
                    JOptionPane.showMessageDialog(null, ex.getMessage());
                }
            }
        });
        mnuWindow.add(menu_item);
        grpWindowList.add(menu_item);
        menu_item.setSelected(true);
        pnlToolKit.setVisible(true);

    }

    public void setWindowMenuItemChecked(String text) {
        int itemCount = mnuWindow.getItemCount();
        for (int i = 0; i < itemCount; i++) {
//if(mnuWindow.getItem(i).getText().equalsIgnoreCase(text))mnuWindow.getItem(i).setC
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuItem1 = new javax.swing.JMenuItem();
        pnlStatusBar = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        lblCurrentWindow = new javax.swing.JLabel();
        jTaskPane1 = new com.l2fprod.common.swing.JTaskPane();
        jTaskPaneGroup1 = new com.l2fprod.common.swing.JTaskPaneGroup();
        jCalendar1 = new com.toedter.calendar.JCalendar();
        mnbMainMenu = new javax.swing.JMenuBar();
        mnuSystem = new javax.swing.JMenu();
        mnuLogin = new javax.swing.JMenuItem();
        mnuLogout = new javax.swing.JMenuItem();
        mnuChangePass = new javax.swing.JMenuItem();
        mnuSysAccount = new javax.swing.JMenu();
        mnuSys_Acc_Account = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        mnuSys_Acc_Role = new javax.swing.JMenuItem();
        mnuSys_Acc_Function = new javax.swing.JMenuItem();
        mnuSys_Exit = new javax.swing.JMenuItem();
        mnuManagement = new javax.swing.JMenu();
        mnuMng_Student = new javax.swing.JMenu();
        mnuMng_StudentInfo = new javax.swing.JMenuItem();
        mnuMngStudentMng = new javax.swing.JMenuItem();
        mnuMng_Course = new javax.swing.JMenu();
        mnuMng_Crs_FeeLevel = new javax.swing.JMenuItem();
        mnuMng_Crs_Rate = new javax.swing.JMenuItem();
        mnuInvoice = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JSeparator();
        mnuMng_Search = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        mnuStatistics = new javax.swing.JMenu();
        mnuStt_Statistics = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        mnuWindow = new javax.swing.JMenu();
        mnuWindow_CloseAll = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        mnuHelp = new javax.swing.JMenu();
        mnuHlp_Help = new javax.swing.JMenuItem();
        mnuHlp_Contact = new javax.swing.JMenuItem();
        mnuHelp_About = new javax.swing.JMenuItem();

        jMenuItem1.setText("SearchOrder");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Tuition Management System");

        pnlStatusBar.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        pnlStatusBar.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        jLabel1.setText("Selected window: ");
        pnlStatusBar.add(jLabel1);

        lblCurrentWindow.setText("...");
        pnlStatusBar.add(lblCurrentWindow);

        getContentPane().add(pnlStatusBar, java.awt.BorderLayout.SOUTH);

        jTaskPaneGroup1.setTitle("Calendar");

        jCalendar1.setDecorationBackgroundColor(new java.awt.Color(204, 204, 255));
        jCalendar1.setOpaque(false);
        jTaskPaneGroup1.getContentPane().add(jCalendar1);

        jTaskPane1.add(jTaskPaneGroup1);

        getContentPane().add(jTaskPane1, java.awt.BorderLayout.LINE_START);

        mnbMainMenu.setName("mnbMainMenu"); // NOI18N

        mnuSystem.setText("File");

        mnuLogin.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
        mnuLogin.setMnemonic('L');
        mnuLogin.setText("Login");
        mnuLogin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuLoginActionPerformed(evt);
            }
        });
        mnuSystem.add(mnuLogin);

        mnuLogout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        mnuLogout.setMnemonic('o');
        mnuLogout.setText("Log out");
        mnuLogout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuLogoutActionPerformed(evt);
            }
        });
        mnuSystem.add(mnuLogout);

        mnuChangePass.setMnemonic('p');
        mnuChangePass.setText("Change password ...");
        mnuChangePass.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuChangePassActionPerformed(evt);
            }
        });
        mnuSystem.add(mnuChangePass);

        mnuSysAccount.setText("Account Management");

        mnuSys_Acc_Account.setText("Account management ...");
        mnuSys_Acc_Account.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuSys_Acc_AccountActionPerformed(evt);
            }
        });
        mnuSysAccount.add(mnuSys_Acc_Account);
        mnuSysAccount.add(jSeparator2);

        mnuSys_Acc_Role.setText("Roles ...");
        mnuSys_Acc_Role.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuSys_Acc_RoleActionPerformed(evt);
            }
        });
        mnuSysAccount.add(mnuSys_Acc_Role);

        mnuSys_Acc_Function.setText("Functions ...");
        mnuSys_Acc_Function.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuSys_Acc_FunctionActionPerformed(evt);
            }
        });
        mnuSysAccount.add(mnuSys_Acc_Function);

        mnuSystem.add(mnuSysAccount);

        mnuSys_Exit.setMnemonic('x');
        mnuSys_Exit.setText("Exit");
        mnuSys_Exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuSys_ExitActionPerformed(evt);
            }
        });
        mnuSystem.add(mnuSys_Exit);

        mnbMainMenu.add(mnuSystem);

        mnuManagement.setText("Management");

        mnuMng_Student.setText("Students");

        mnuMng_StudentInfo.setText("Student Information");
        mnuMng_StudentInfo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMng_StudentInfoActionPerformed(evt);
            }
        });
        mnuMng_Student.add(mnuMng_StudentInfo);

        mnuMngStudentMng.setText("Student Management");
        mnuMngStudentMng.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMngStudentMngActionPerformed(evt);
            }
        });
        mnuMng_Student.add(mnuMngStudentMng);

        mnuManagement.add(mnuMng_Student);

        mnuMng_Course.setText("Courses");

        mnuMng_Crs_FeeLevel.setText("Fee Level");
        mnuMng_Crs_FeeLevel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMng_Crs_FeeLevelActionPerformed(evt);
            }
        });
        mnuMng_Course.add(mnuMng_Crs_FeeLevel);

        mnuMng_Crs_Rate.setText("Rate");
        mnuMng_Crs_Rate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuMng_Crs_RateActionPerformed(evt);
            }
        });
        mnuMng_Course.add(mnuMng_Crs_Rate);

        mnuManagement.add(mnuMng_Course);

        mnuInvoice.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuInvoiceActionPerformed(evt);
            }
        });
        mnuManagement.add(mnuInvoice);
        mnuManagement.add(jSeparator3);

        mnuMng_Search.setText("Search");
        mnuManagement.add(mnuMng_Search);

        jMenuItem2.setText("SearchOrder");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        mnuManagement.add(jMenuItem2);

        mnbMainMenu.add(mnuManagement);

        mnuStatistics.setText("Statistics");

        mnuStt_Statistics.setText("Order Statistics");
        mnuStt_Statistics.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuStt_StatisticsActionPerformed(evt);
            }
        });
        mnuStatistics.add(mnuStt_Statistics);

        jMenuItem3.setText("Invoice Statictics");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        mnuStatistics.add(jMenuItem3);

        mnbMainMenu.add(mnuStatistics);

        mnuWindow.setText("Window");

        mnuWindow_CloseAll.setText("Close All");
        mnuWindow_CloseAll.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuWindow_CloseAllActionPerformed(evt);
            }
        });
        mnuWindow.add(mnuWindow_CloseAll);

        jSeparator1.setEnabled(false);
        mnuWindow.add(jSeparator1);

        mnbMainMenu.add(mnuWindow);

        mnuHelp.setText("Help");

        mnuHlp_Help.setText("Help");
        mnuHlp_Help.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuHlp_HelpActionPerformed(evt);
            }
        });
        mnuHelp.add(mnuHlp_Help);

        mnuHlp_Contact.setText("Contact Us");
        mnuHlp_Contact.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuHlp_ContactActionPerformed(evt);
            }
        });
        mnuHelp.add(mnuHlp_Contact);

        mnuHelp_About.setText("About ...");
        mnuHelp_About.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuHelp_AboutActionPerformed(evt);
            }
        });
        mnuHelp.add(mnuHelp_About);

        mnbMainMenu.add(mnuHelp);

        setJMenuBar(mnbMainMenu);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mnuLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuLoginActionPerformed
        // linkMenuWithEvent(new JPanel(), "New Child form", true);
        //JFrame frmLogin=new JFrame("Login");
        LoginDialog dlgLogin = new LoginDialog(this, true);
        dlgLogin.setTitle("Login");
        dlgLogin.setResizable(false);
        dlgLogin.setLocationRelativeTo(this.getContentPane());
        dlgLogin.setVisible(true);
        if (CurrentAccount != null) {
            mnuLogin.setVisible(false);
            mnuLogout.setVisible(true);
        }

}//GEN-LAST:event_mnuLoginActionPerformed

    private void mnuWindow_CloseAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuWindow_CloseAllActionPerformed
        // TODO add your handling code here:
        int item_count = mnuWindow.getItemCount();
        if (item_count > 2) {
            for (int i = item_count - 1; i >= 2; i--) {
                JRadioButtonMenuItem item = (JRadioButtonMenuItem) mnuWindow.getItem(i);
                if (item != null) {
                    getInnerWindow(item.getText()).dispose();
                    mnuWindow.remove(item);
                    item_count--;
                    if (counter > 0) {
                        counter--;
                    }
                }
            }
        }
}//GEN-LAST:event_mnuWindow_CloseAllActionPerformed

    private void mnuHelp_AboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuHelp_AboutActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new AboutUs(), "About", false);
}//GEN-LAST:event_mnuHelp_AboutActionPerformed

    private void mnuChangePassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuChangePassActionPerformed
        // TODO add your handling code here:
        ChangePasswordDialog dlgChangePass = new ChangePasswordDialog(this, true);
        dlgChangePass.setTitle("Change password");
        dlgChangePass.setResizable(false);
        dlgChangePass.setLocationRelativeTo(this);
        dlgChangePass.setVisible(true);
    }//GEN-LAST:event_mnuChangePassActionPerformed

    private void mnuSys_Acc_AccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSys_Acc_AccountActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new tuitionmanagement.gui.pnlAccountManagement(), "Account Manager", false);
    }//GEN-LAST:event_mnuSys_Acc_AccountActionPerformed

    private void mnuSys_Acc_RoleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSys_Acc_RoleActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new tuitionmanagement.gui.pnlRoleManagement(), "Roles", false);
    }//GEN-LAST:event_mnuSys_Acc_RoleActionPerformed

    private void mnuSys_Acc_FunctionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSys_Acc_FunctionActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new tuitionmanagement.gui.pnlFunctionManagement(), "Functions", false);
    }//GEN-LAST:event_mnuSys_Acc_FunctionActionPerformed

    private void mnuSys_ExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuSys_ExitActionPerformed
        // TODO add your handling code here:
        this.dispose();
        System.exit(0);
    }//GEN-LAST:event_mnuSys_ExitActionPerformed

    private void mnuMng_StudentInfoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMng_StudentInfoActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new StudentInformation(), "Student Information", false);
    }//GEN-LAST:event_mnuMng_StudentInfoActionPerformed

    private void mnuMngStudentMngActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMngStudentMngActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new StudentManagement(), "Student Management", false);
    }//GEN-LAST:event_mnuMngStudentMngActionPerformed

    private void mnuMng_Crs_FeeLevelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMng_Crs_FeeLevelActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new FeeManagement(), "Fee Level", false);
    }//GEN-LAST:event_mnuMng_Crs_FeeLevelActionPerformed

    private void mnuMng_Crs_RateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuMng_Crs_RateActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new tuitionmanagement.gui.Rate(), "Rate", false);
    }//GEN-LAST:event_mnuMng_Crs_RateActionPerformed

    private void mnuStt_StatisticsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuStt_StatisticsActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new Statistics(), "Statistics", false);
    }//GEN-LAST:event_mnuStt_StatisticsActionPerformed

    private void mnuHlp_ContactActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuHlp_ContactActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new ContactUs(), "Contact Us", false);
    }//GEN-LAST:event_mnuHlp_ContactActionPerformed

    private void mnuHlp_HelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuHlp_HelpActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new tuitionmanagement.gui.Help(), "Help", false);
    }//GEN-LAST:event_mnuHlp_HelpActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new tuitionmanagement.gui.SearchOrder(), "SearchOrder", false);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void mnuLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuLogoutActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(this, "Are you sure want to log out system?","Confimr",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)!=0){
            return;
        }
        CurrentAccount=null;
        mnuLogin.setVisible(true);
        mnuLogout.setVisible(false);
    }//GEN-LAST:event_mnuLogoutActionPerformed


    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new tuitionmanagement.gui.StaticticInvoice(), "StaticticInvoice", false);
    }//GEN-LAST:event_jMenuItem3ActionPerformed


    private void mnuInvoiceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuInvoiceActionPerformed
        // TODO add your handling code here:
        linkMenuWithEvent(new InvoicePanel(), "Invoice", false);
    }//GEN-LAST:event_mnuInvoiceActionPerformed


    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MainWindow().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private com.toedter.calendar.JCalendar jCalendar1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private com.l2fprod.common.swing.JTaskPane jTaskPane1;
    private com.l2fprod.common.swing.JTaskPaneGroup jTaskPaneGroup1;
    private javax.swing.JLabel lblCurrentWindow;
    private javax.swing.JMenuBar mnbMainMenu;
    private javax.swing.JMenuItem mnuChangePass;
    private javax.swing.JMenu mnuHelp;
    private javax.swing.JMenuItem mnuHelp_About;
    private javax.swing.JMenuItem mnuHlp_Contact;
    private javax.swing.JMenuItem mnuHlp_Help;
    private javax.swing.JMenuItem mnuInvoice;
    private javax.swing.JMenuItem mnuLogin;
    private javax.swing.JMenuItem mnuLogout;
    private javax.swing.JMenu mnuManagement;
    private javax.swing.JMenuItem mnuMngStudentMng;
    private javax.swing.JMenu mnuMng_Course;
    private javax.swing.JMenuItem mnuMng_Crs_FeeLevel;
    private javax.swing.JMenuItem mnuMng_Crs_Rate;
    private javax.swing.JMenuItem mnuMng_Search;
    private javax.swing.JMenu mnuMng_Student;
    private javax.swing.JMenuItem mnuMng_StudentInfo;
    private javax.swing.JMenu mnuStatistics;
    private javax.swing.JMenuItem mnuStt_Statistics;
    private javax.swing.JMenu mnuSysAccount;
    private javax.swing.JMenuItem mnuSys_Acc_Account;
    private javax.swing.JMenuItem mnuSys_Acc_Function;
    private javax.swing.JMenuItem mnuSys_Acc_Role;
    private javax.swing.JMenuItem mnuSys_Exit;
    private javax.swing.JMenu mnuSystem;
    private javax.swing.JMenu mnuWindow;
    private javax.swing.JMenuItem mnuWindow_CloseAll;
    private javax.swing.JPanel pnlStatusBar;
    // End of variables declaration//GEN-END:variables
}
